package com.hontech.bread.ui.parts

import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.Button
import android.widget.FrameLayout
import com.hontech.bread.R
import com.hontech.bread.device.rightPushPush
import com.hontech.bread.device.rightPushReset
import com.hontech.bread.ui.dialog.runProg
import com.hontech.bread.utils.onClick
import com.hontech.bread.utils.stringById

class RightPushMotorParts(context: Context, attrs: AttributeSet) : FrameLayout(context, attrs) {

    init {
        val view = LayoutInflater.from(context).inflate(R.layout.parts_right_push_test, this)
        val reset = view.findViewById<Button>(R.id.id_right_push_btn_reset)
        val push = view.findViewById<Button>(R.id.id_right_push_btn_push)

        reset.onClick {
            runProg(stringById(R.string.t1733460848_433), stringById(R.string.t1733460848_434)) {
                rightPushReset()
            }
        }
        push.onClick {
            runProg(stringById(R.string.t1733460848_435), stringById(R.string.t1733460848_436)) {
                rightPushPush()
            }
        }
    }
}

